# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.VectorTile.V1.Api.Terraintiles do
  @moduledoc """
  API calls for all endpoints tagged `Terraintiles`.
  """

  alias GoogleApi.VectorTile.V1.Connection
  alias GoogleApi.Gax.{Request, Response}

  @library_version Mix.Project.config() |> Keyword.get(:version, "")

  @doc """
  Gets a terrain tile by its tile resource name.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.VectorTile.V1.Connection.t`) - Connection to server
  *   `name` (*type:* `String.t`) - Required. Resource name of the tile. The tile resource name is prefixed by its collection ID `terraintiles/` followed by the resource ID, which encodes the tile's global x and y coordinates and zoom level as `@,,z`. For example, `terraintiles/@1,2,3z`.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
      *   `:access_token` (*type:* `String.t`) - OAuth access token.
      *   `:alt` (*type:* `String.t`) - Data format for response.
      *   `:callback` (*type:* `String.t`) - JSONP
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
      *   `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
      *   `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
      *   `:altitudePrecisionCentimeters` (*type:* `integer()`) - The precision of terrain altitudes in centimeters. Possible values: between 1 (cm level precision) and 1,000,000 (10-kilometer level precision).
      *   `:"clientInfo.apiClient"` (*type:* `String.t`) - API client name and version. For example, the SDK calling the API. The exact format is up to the client.
      *   `:"clientInfo.applicationId"` (*type:* `String.t`) - Application ID, such as the package name on Android and the bundle identifier on iOS platforms.
      *   `:"clientInfo.applicationVersion"` (*type:* `String.t`) - Application version number, such as "1.2.3". The exact format is application-dependent.
      *   `:"clientInfo.deviceModel"` (*type:* `String.t`) - Device model as reported by the device. The exact format is platform-dependent.
      *   `:"clientInfo.operatingSystem"` (*type:* `String.t`) - Operating system name and version as reported by the OS. For example, "Mac OS X 10.10.4". The exact format is platform-dependent.
      *   `:"clientInfo.platform"` (*type:* `String.t`) - Platform where the application is running.
      *   `:"clientInfo.userId"` (*type:* `String.t`) - Required. A client-generated user ID. The ID should be generated and persisted during the first user session or whenever a pre-existing ID is not found. The exact format is up to the client. This must be non-empty in a GetFeatureTileRequest (whether via the header or GetFeatureTileRequest.client_info).
      *   `:maxElevationResolutionCells` (*type:* `integer()`) - The maximum allowed resolution for the returned elevation heightmap. Possible values: between 1 and 1024 (and not less than min_elevation_resolution_cells). Over-sized heightmaps will be non-uniformly down-sampled such that each edge is no longer than this value. Non-uniformity is chosen to maximise the amount of preserved data. For example: Original resolution: 100px (width) * 30px (height) max_elevation_resolution: 30 New resolution: 30px (width) * 30px (height)
      *   `:minElevationResolutionCells` (*type:* `integer()`) -  api-linter: core::0131::request-unknown-fields=disabled aip.dev/not-precedent: Maintaining existing request parameter pattern. The minimum allowed resolution for the returned elevation heightmap. Possible values: between 0 and 1024 (and not more than max_elevation_resolution_cells). Zero is supported for backward compatibility. Under-sized heightmaps will be non-uniformly up-sampled such that each edge is no shorter than this value. Non-uniformity is chosen to maximise the amount of preserved data. For example: Original resolution: 30px (width) * 10px (height) min_elevation_resolution: 30 New resolution: 30px (width) * 30px (height)
      *   `:terrainFormats` (*type:* `list(String.t)`) - Terrain formats that the client understands.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.VectorTile.V1.Model.TerrainTile{}}` on success
  *   `{:error, info}` on failure
  """
  @spec vectortile_terraintiles_get(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.VectorTile.V1.Model.TerrainTile.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def vectortile_terraintiles_get(connection, name, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :"$.xgafv" => :query,
      :access_token => :query,
      :alt => :query,
      :callback => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :uploadType => :query,
      :upload_protocol => :query,
      :altitudePrecisionCentimeters => :query,
      :"clientInfo.apiClient" => :query,
      :"clientInfo.applicationId" => :query,
      :"clientInfo.applicationVersion" => :query,
      :"clientInfo.deviceModel" => :query,
      :"clientInfo.operatingSystem" => :query,
      :"clientInfo.platform" => :query,
      :"clientInfo.userId" => :query,
      :maxElevationResolutionCells => :query,
      :minElevationResolutionCells => :query,
      :terrainFormats => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/v1/{+name}", %{
        "name" => URI.encode(name, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.VectorTile.V1.Model.TerrainTile{}])
  end
end
